package com.example.testtouch2;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import android.util.Log;

import com.demo.androidgame.fx.FileIO;

public class SettingsColliderIO {
    
    public final static String[] highscores = new String[37];
    public final static String file = "TestCollider.txt";
    public final static String file2 = "TestCollider2.txt";
    public final static String file3 = "TestCollider3.txt";
    public final static String file4 = "TestCollider4.txt";
    public static int level = 0;
    
    public static void load(FileIO files) {
        BufferedReader in = null;
        level +=1;
        try {
        	
            Log.d("tag", Integer.toString(level));
            
            switch (level) {
			case 1:
				in = new BufferedReader(new InputStreamReader(files.readFile(file)));
				break;
			case 2:
				in = new BufferedReader(new InputStreamReader(files.readFile(file2)));
				break;
			case 3:
				in = new BufferedReader(new InputStreamReader(files.readFile(file3)));
				break;
			case 4:
				in = new BufferedReader(new InputStreamReader(files.readFile(file4)));
				break;
            }
            
            for(int i = 0; i < 37; i++) {
                highscores[i] = in.readLine();
            }
        } catch (IOException e) {
            // :( It's ok we have defaults
        } catch (NumberFormatException e) {
            // :/ It's ok, defaults save our day
        } catch (Exception ex) {
        } finally {
            try {
                if (in != null)
                    in.close();
            } catch (IOException e) {
            }
        }
    }
}